/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author u0506783
 */

import UI.*;
import java.io.*;
import java.net.*;
import java.lang.*;
import java.util.*;

public class ClientChatStart {
    public String ack;
    public String IP;
    public String socket;
	public String thisIP;

    public ClientChatStart() throws Exception{
        this.IP = "192.168.1.144";
        this.socket = socket;
        this.ClientChatStart1();
    }

	public static void main(String args[]) throws Exception
	{
		new ClientChatStart();
		ChatListener chats = new ChatListener();
		Thread chatThread = new Thread(chats);
		chatThread.start();
		
	}
	
    public void ClientChatStart1() throws Exception
    {
        Socket clientSocket = new Socket(IP, 3456);
        DataOutputStream outToServer2 =
        new DataOutputStream(clientSocket.getOutputStream());
        //new DataOutputStream(clientSocket.getOutputStream());
        //System.out.print("1");

        thisIP = clientSocket.getLocalAddress().toString().substring(1);
        
        outToServer2.writeBytes("Hello"+'\n');

        BufferedReader inFromServer2 =
        new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
        ack = inFromServer2.readLine();
        System.out.println("FROM CLIENT: " + ack);

        clientSocket.close();
        outToServer2.close();
        inFromServer2.close();
    }
}